import getConfig from 'next/config';
const { publicRuntimeConfig } = getConfig();
const { NODE_ENV } = publicRuntimeConfig;

interface BaseURLState {
	api8: string;
	user: string;
	passport: string;
	common: string;
	tracking: string;
	gameLogin: string;
}

let baseURL: BaseURLState = {
	api8: '',
	user: '',
	passport: '',
	common: '',
	tracking: '',
	gameLogin: ''
};

if (NODE_ENV === 'development') {
	baseURL = {
		api8: 'http://api8.xubei-test.com',
		user: 'http://user-server.xubei-test.com',
		passport: 'http://passport-server.xubei-test.com',
		common: 'http://common-server.xubei-test.com',
		tracking: 'http://tracking.xubei-test.com',
		gameLogin: 'http://gamelogin-api.xubei-test.com'
	};
} else if (NODE_ENV === 'production') {
	baseURL = {
		api8: 'https://api8.xubei.com',
		user: 'https://user-server.xubei.com',
		passport: 'https://passport-server.xubei.com',
		common: 'https://common-server.xubei.com',
		tracking: 'https://tracking.xubei.com',
		gameLogin: 'https://gamelogin-api.xubei.com'
	};
} else {
	baseURL = {
		api8: 'http://api8.xubei-test.com',
		user: 'http://user-server.xubei-test.com',
		passport: 'http://passport-server.xubei-test.com',
		common: 'http://common-server.xubei-test.com',
		tracking: 'http://tracking.xubei-test.com',
		gameLogin: 'http://gamelogin-api.xubei-test.com'
	};
}

export default baseURL;
